<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Global对象</title>
    <script>
        /*
            Global
				1.特点: 全局对象,这个 Global 中封装的方法不需要对象就可以直接调用 方法名();
				2.方法:
					encodeURI(): URL编码
					decodeURI(): URL解码

					encodeURIComponent(): URL编码,编码的字符多
					decodeURIComponent(): URL解码

					parseInt(): 将字符串转为数字
						逐一判断每一个字符是否是数字,直到不是数字为止,将前边数字部分转为 number
					isNaN: 判断一个值是否是 NaN
						NaN六亲不认,连自己都不认 NaN参与的==比较全部为 false

					eval(): 将 JavaScript 字符串,并把它作为脚本代码来执行
				3.URL编码
				    传智播客 = %E4%BC%A0%E6%99%BA%E6%92%AD%E5%AE%A2
         */
        //encodeURI() url编码
        var str = "https://www.baidu.com/传智播客";
        var encode = encodeURI(str);
        document.write("encodeURI = " + encode + "<br>");
        //decodeURI() url解码
        var decode = decodeURI(str);
        document.write("decodeURI = " + decode + "<br>");

        //encodeURIComponent() url编码,编码的字符多
        var srt2 = "https://www.baidu.com/传智播客";
        var encode2 = encodeURIComponent(srt2);
        document.write("encodeURIComponent = " + encode2 + "<br>");
        //decodeURIComponent() url解码
        var decode2 = decodeURIComponent(srt2);
        document.write("decodeURIComponent = " + decode2 + "<br>");

        //parseInt() 将字符串转为数字
        var srt3 = "1231adfa";
        var parse = parseInt(srt3);
        document.write("parseInt = " + (parse + 1) + "<br>");

        //isNaN 判断一个值是否是NaN
        var a = NaN;
        document.write((a == NaN) + "<br>");
        document.write(isNaN(a) + "<br>");

        //eval() 将 JavaScript 字符串,并把它作为脚本代码来执行
        var jscode = "alert(12312)";
        eval(jscode);




    </script>
</head>
<body>

</body>
</html>